package com.xkdx.caipiao.fragment;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.xkdx.caipiao.R;
import com.xkdx.caipiao.my.RegisterActivity;
import com.xkdx.caipiao.presistence.findpsw.FindPwsActivity;
import com.xkdx.caipiao.statics.IConstants;
import com.xkdx.guangguang.LoginActivity;

public class MyLotterFragment extends Fragment {
	private View view;
	private Context context;
	TextView titel_info;
	TextView tv_foget_psw,forget_zhuce;
	public MyLotterFragment(){
		
	}
	public MyLotterFragment(Context cx) {
		this.context = cx;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onAttach(Activity activity) {
		
		super.onAttach(activity);
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		view = inflater.inflate(R.layout.logindefault_caipiao, container, false);
		Button btn = (Button) view.findViewById(R.id.btn_login);
		forget_zhuce = (TextView) view.findViewById(R.id.tv_zhuce);
		forget_zhuce.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//给textview添加下划线
		forget_zhuce.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(context, RegisterActivity.class);
				startActivityForResult(intent, 300);
			}
		});
		btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(context, LoginActivity.class);
				startActivity(intent);
			}
		});
		titel_info = (TextView) view.findViewById(R.id.title_info);
		titel_info.setVisibility(View.GONE);
		titel_info.setText("注册");
		titel_info.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(getActivity(), RegisterActivity.class);
				startActivityForResult(intent, 300);
			}
		});
		tv_foget_psw = (TextView) view.findViewById(R.id.forget_password);
		tv_foget_psw.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(getActivity(),
						FindPwsActivity.class);
				startActivity(intent);
			}
		});
		return view;
	}

	@Override
	public void onActivityResult(int arg0, int arg1, Intent arg2) {
		super.onActivityResult(arg0, arg1, arg2);
		if (arg1 == 301) {
			IConstants.FromRadioButton = 1;
		
		}
	}
}
